home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
038a
/
bas_int1.zip
/
CHGDRV2.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-05-26
|
2KB
|
45 lines
'===================================================================
' Quick Basic Forum
' Date : 25-Apr-91 18:39
' From : David Ellsworth
'Subject : Setting Default Drive.
'
' DOS Interrupt 21h (33 decimal) Function 0Eh (14) is the ticket.
' Run QB with the /L option.
' Provide a TYPE'd variable to pass data and declare the needed
' subroutine (or use '$INCLUDE: 'QB.BI') for a call to INTERRUPT.
'===================================================================
' Eg.
TYPE RegType
ax AS INTEGER
bx AS INTEGER
cx AS INTEGER
dx AS INTEGER
bp AS INTEGER
si AS INTEGER
di AS INTEGER
flags AS INTEGER
END TYPE
DECLARE SUB INTERRUPT (Intnum AS INTEGER, InReg AS RegType, OutReg AS
RegType)
DIM InReg AS RegType, OutReg AS RegType
' When you want to set a new default drive call the interrupt with the proper
' register settings.
' Eg.
DriveNumber = 2: 'Set C:
InReg.ax = &HE00: 'Call function 0Eh
InReg.dx = DriveNumber: 'Zero based (A: = 0 through Z: = 25).
INTERRUPT &H21, InReg, OutReg
' As a point of interest the last drive number is returned in the AL register.
LastDrive$ = CHR$((OutReg.ax AND 31) + 64) + ":"
' The last drive number in AL is 1 based (1 = A: through 26 = Z:).
' To find the default drive you can use Function 19h.
InReg.ax = &H1900; (OutReg.ax and 31) = Current drive; 0 = A: - 25 = Z:
' You can also find the default directory with Function 47h.